<script type="text/javascript">
function dong()
{
	window.close();
}

<?php
	if($close)
	{
?>
		window.opener.insertImage("<?php echo $id; ?>","<?php echo $imageurl; ?>");
		dong();
<?php
	}
?>
</script>

<form method="post" enctype="multipart/form-data">
	<input type="file" name="imageFile"/>
	<input type="submit" name="upload" value="upload" />
</form>